package com.gblfy.api;

import com.gblfy.api.factory.RemoteProductFallbackFactory;
import com.gblfy.common.constant.ServiceNameConstants;
import com.gblfy.common.dto.UserDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@FeignClient(value = ServiceNameConstants.PRODUCT_SERVICE, contextId = "remoteProductService", fallbackFactory = RemoteProductFallbackFactory.class)
public interface RemoteProductService {

    /**
     * 根据产品ID获取产品名称
     *
     * @param productId
     * @return
     */
    @GetMapping("/product/{productId}")
    String getProductName(@PathVariable Integer productId);

    /**
     * http://user-center/users/{id}
     *
     * @param id
     * @return
     */
    @GetMapping("/users/{id}")
    UserDTO findById(@PathVariable Integer id);

}
